#include<iostream>
using namespace std;

signed main()
{
    string d,s;
    int n;
    cin>>d>>n;
    while(--n){
        for(int i=0;i<d.size();i++){
            int num = 1;
            while(i+1<d.size()&&d[i+1]==d[i])    num++,i++;
            s.append(1,d[i]);
            s.append(1,num+'0');
        }
        d = s;
        s.clear();
    }
    cout<<d;
    return 0;
}
